<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% 

String basePath = request.getScheme() + "://" + request.getServerName()
		+ ":" + request.getServerPort() + request.getContextPath()
		+ "/";

request.setAttribute("basePath", basePath);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>文件监控页</title>
<style type="text/css">
body{
	background-color:#ebf5ff;	/* 页面背景色 */
	margin:0px; padding:4px;
	text-align:center;			/* 居中对齐（IE有效） */
}
.datalist{
	color:#0046a6;				/* 表格文字颜色 */
	background-color:#d2e8ff;	/* 表格背景色 */
	font-family:Arial;			/* 表格字体 */
}
.datalist caption{
	font-size:18px;				/* 标题文字大小 */
	font-weight:bold;			/* 标题文字粗体 */
}
.datalist th{
	width:150px;
	color:#003e7e;				/* 行、列名称颜色 */
	background-color:#7bb3ff;	/* 行、列名称的背景色 */
}

.data-delete{
	cursor: pointer;
}

</style>
<script type="text/javascript" src="${basePath}js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
	//绑定删除按钮
	$(".datalist").on("click", ".data-delete", function(){
		var id = $(this).attr("value");
		if(id!=null && id!=""){
			$.ajax({
				type : "post",
				url : "${basePath}images/fileDelete.action",
				data : {"id":id},
				success : function(){
					
				}
			});
			
			$("#"+id).remove();
		}
		
	});
});
</script>


</head>
<body>
<div>
	<table class="datalist">
		<thead>
		<tr><th>硬盘位置</th><th>文件总数</th><th>大小</th></tr>
		</thead>
		<tbody>
		<tr><td>${webRootPath}</td><td>${filecount}</td><td>${filesize}</td></tr>
		</tbody>
	</table>
</div>
<div>
	<table class="datalist">
		<thead>
		<tr><th>NO</th><th>文件名称</th><th>上传者</th><th>大小</th><th>上传时间</th><th>操作</th></tr>
		</thead>
		<tbody>
		<c:forEach items="${fileList}" varStatus="vs" var="v">
			<tr id="${v.id}">
			<td>${vs.count}</td>
			<td><a href="${basePath}images/download.action?fname=${v.filename}" target="_blank">${v.oname}</a></td>
			<td>${v.ip}</td>
			<td>${v.size}</td>
			<td>${v.setdate}</td>
			<td><a value="${v.id}" class="data-delete">删除</a></td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</div>
</body>
</html>